/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * CJanelaMensagem.java
 *
 * Created on 01/02/2011, 13:46:07
 */

package rpt.lib.sistema;

import java.awt.Component;

/**
 *
 * @author Roberto
 */
public class CJanelaMensagem extends javax.swing.JDialog {

    private boolean fOk = false;
    private boolean fCancelar = false;

    /** Creates new form CJanelaMensagem */
    public CJanelaMensagem(
            final Component aParent,
            final String aTitulo,
            final String aMensagem) {
        initComponents();
        setTitulo(aTitulo);
        setMensagem(aMensagem);
    }

    public void setTitulo(final String aMensagem) {
        swLblMensagem.setText(aMensagem);
    }

    public String getTitulo() {
        return swLblMensagem.getText();
    }

    public void setMensagem(final String aMensagem) {
        swTxaMensagem.setText(aMensagem);
    }

    public String getMensagem() {
        return swTxaMensagem.getText();
    }


    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        swPnlTopo = new javax.swing.JPanel();
        swLblMensagem = new javax.swing.JLabel();
        swPnlCentro = new javax.swing.JPanel();
        swScpMensagem = new javax.swing.JScrollPane();
        swTxaMensagem = new javax.swing.JTextArea();
        swPnlFundo = new javax.swing.JPanel();
        swBtnOk = new java.awt.Button();
        swBtnCancelar = new java.awt.Button();

        swPnlTopo.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
        swPnlTopo.setMinimumSize(new java.awt.Dimension(100, 50));
        swPnlTopo.setPreferredSize(new java.awt.Dimension(400, 50));

        swLblMensagem.setFont(new java.awt.Font("Arial", 0, 24));
        swLblMensagem.setText("TITULO DA MENSAGEM");

        javax.swing.GroupLayout swPnlTopoLayout = new javax.swing.GroupLayout(swPnlTopo);
        swPnlTopo.setLayout(swPnlTopoLayout);
        swPnlTopoLayout.setHorizontalGroup(
            swPnlTopoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(swPnlTopoLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(swLblMensagem)
                .addContainerGap(246, Short.MAX_VALUE))
        );
        swPnlTopoLayout.setVerticalGroup(
            swPnlTopoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(swPnlTopoLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(swLblMensagem)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        getContentPane().add(swPnlTopo, java.awt.BorderLayout.NORTH);

        swPnlCentro.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
        swPnlCentro.setLayout(new java.awt.BorderLayout());

        swTxaMensagem.setColumns(20);
        swTxaMensagem.setFont(new java.awt.Font("Arial", 0, 14));
        swTxaMensagem.setLineWrap(true);
        swTxaMensagem.setRows(1);
        swTxaMensagem.setText("MENSAGEM");
        swScpMensagem.setViewportView(swTxaMensagem);

        swPnlCentro.add(swScpMensagem, java.awt.BorderLayout.CENTER);

        getContentPane().add(swPnlCentro, java.awt.BorderLayout.CENTER);

        swPnlFundo.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
        swPnlFundo.setMinimumSize(new java.awt.Dimension(100, 50));
        swPnlFundo.setPreferredSize(new java.awt.Dimension(400, 50));

        swBtnOk.setBackground(new java.awt.Color(204, 204, 204));
        swBtnOk.setFont(new java.awt.Font("Arial", 1, 18));
        swBtnOk.setLabel("Ok");
        swBtnOk.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                swBtnOkActionPerformed(evt);
            }
        });

        swBtnCancelar.setBackground(new java.awt.Color(204, 204, 204));
        swBtnCancelar.setFont(new java.awt.Font("Arial", 1, 18));
        swBtnCancelar.setLabel("Cancelar");
        swBtnCancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                swBtnCancelarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout swPnlFundoLayout = new javax.swing.GroupLayout(swPnlFundo);
        swPnlFundo.setLayout(swPnlFundoLayout);
        swPnlFundoLayout.setHorizontalGroup(
            swPnlFundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(swPnlFundoLayout.createSequentialGroup()
                .addComponent(swBtnOk, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(swBtnCancelar, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(274, Short.MAX_VALUE))
        );
        swPnlFundoLayout.setVerticalGroup(
            swPnlFundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(swBtnOk, javax.swing.GroupLayout.DEFAULT_SIZE, 46, Short.MAX_VALUE)
            .addComponent(swBtnCancelar, javax.swing.GroupLayout.DEFAULT_SIZE, 46, Short.MAX_VALUE)
        );

        getContentPane().add(swPnlFundo, java.awt.BorderLayout.SOUTH);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void swBtnOkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_swBtnOkActionPerformed
        fOk = true;
        fCancelar = false;
    }//GEN-LAST:event_swBtnOkActionPerformed

    private void swBtnCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_swBtnCancelarActionPerformed
        fOk = true;
        fCancelar = false;
    }//GEN-LAST:event_swBtnCancelarActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new CJanelaMensagem(null,"Teste","Teste 1\nTeste2\nTeste3").setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private java.awt.Button swBtnCancelar;
    private java.awt.Button swBtnOk;
    private javax.swing.JLabel swLblMensagem;
    private javax.swing.JPanel swPnlCentro;
    private javax.swing.JPanel swPnlFundo;
    private javax.swing.JPanel swPnlTopo;
    private javax.swing.JScrollPane swScpMensagem;
    private javax.swing.JTextArea swTxaMensagem;
    // End of variables declaration//GEN-END:variables

}
